package com.neusoft.ysu.his.mapper;

import com.neusoft.ysu.his.entity.Dept;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.neusoft.ysu.his.entity.Register;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 作者：赵子鉴
 * @since 2023-08-25
 */
@Mapper
public interface DeptMapper extends BaseMapper<Dept> {

    @Select("select * from dept where id=#{id}")
    public Dept findDeptById(int id);

    @Select("select * from dept where dept_code=#{deptCode}")
    Dept findByCode(int deptCode);

    @Update("UPDATE dept set  dept_name=#{deptName}, dept_type=#{deptType} where dept_code=#{deptCode};")
    int updateByCode(Dept dept);


    @Select("select * from dept where deptname like '%#{name}%'")
    Register findByName(int name);

    int updateByregnum(Register register);

    @Update("UPDATE dept set delmark=#{delmark} where dept_code=#{deptCode}")
    int deleteByregnum(Dept dept);
}
